package com.j2some;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.RequestGongWuShu.envMonitoring;
import com.yishun.springboot.Application;
import com.yishun.springboot.mapper.ElectricityMonitoringDetailedMapper;
import com.yishun.springboot.mapper.RecordNumMapper;
import com.yishun.springboot.mapper.TspDetailedMapper;
import com.yishun.springboot.mapper.TspGetDataMapper;
import com.yishun.springboot.service.GongWuSuTimedUploadTspService;

import lombok.extern.slf4j.Slf4j;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@Slf4j
public class Principal_SeMybatisTestTsp {
	final static String BaseUrl = "http://47.99.64.49:2000";

	@Autowired
	TspDetailedMapper tspDetailedMapper;

	@Autowired
	TspGetDataMapper tspGetDataMapper;

	@Autowired
	GongWuSuTimedUploadTspService tspService;

	@Autowired
	RecordNumMapper recordNumMapper;

	@Autowired
	ElectricityMonitoringDetailedMapper electricityMonitoringDetailedMapper;

	// tsp设备各类 √
	public void UpdateGWSTSPBase() {

		// 上传整表tsp基本数据
//		tspService.UpdateGongWuShuTspMoreBaseData();

		int resultNum = 0;
		try {
			resultNum = recordNumMapper.findSomeByconditions(1);
		} catch (NullPointerException e) {
			log.info("昨日或今日记录为空，请注意general_record_numBeans的情况" + resultNum);
			// TODO: handle exception
		}

//web 资源统计
		// int looknum;
//		looknum = tspGetDataMapper.findTodayTspTotalNum();
//		log.info("f:"+looknum);
//		looknum = tspGetDataMapper.findYesterdayTspTotalNum();
//		log.info("s:"+looknum);
//		looknum = tspGetDataMapper.findOnedayTspTotalNum("2020-12-16");
//		log.info("t:"+looknum);
//		looknum = (tspGetDataMapper.findOneweekTspTotalNumAverage());
//		log.info("t:"+looknum);

		/**
		 * 插入一条bean对象到tsp_detailed表
		 */
//tspService.UpdateGongWuShuTspMoreBaseData();

//		TspHaveDevCode tspHaveDevCode = new TspHaveDevCode();
//		tspHaveDevCode.setDevice_code("440103301045022105002889");
//		tspDetailedMapper.innerOneRecord(tspHaveDevCode);

		envMonitoring eM = new envMonitoring();
		// {"api_key":"5dec9dc9510a48c3a9f1362cef47b315","signature":"874D45C8CD0C9B7ABB01BC1B45C0097D","project_code":"XM20170281","api_version":"1.0","body":{"install_company":"广东美术馆、广东非物质文化遗产展示中心、广东文学馆“三馆合一”","device_no":"44010330104502210500288100000000","install_address":"没有地点"},"eng_code":"GDSYEQ-010-2019","timestamp":"2020-12-15
		// 15:38:21"}
//		RequestGongWuShuTspBaseInfo r = tspGetDataMapper.findRecentlyBaseInfoOneSendGWS("440103301045022105002881");
//		r.setName("19#测试井");
//		eM.addBasicInfo(r);

		// 上传一条实时数据到工务署
//    	RequestGongWuShuTspRealTimeData r2 = tspGetDataMapper.findRecentlyRealTimeOneSendGWS("000000YKDZHJJC0000000517");
//		log.info("r info:"+r2.toString());    	
//		eM.addRecord(r2);
	}

}
